"""
WSGI Core Services Application setup.
"""
import os
import sys

# import set_sys_path

from webapp2 import WSGIApplication, Route, SimpleRoute, RequestHandler

class FindAppYaml(RequestHandler):
    def get(self):
        curdir = os.path.abspath(os.path.dirname(__file__))
        while True:
            appyaml = os.path.join(curdir, 'app.yaml')
            if os.path.exists(appyaml):
                self.response.out.write('Found app.yaml %s<br>' % appyaml)
                break
            curdir = os.path.join(curdir, '..')
        self.response.out.write('Done<br>')

ROUTES = [
    ('/find-app-yaml', FindAppYaml),
]

APP = WSGIApplication(ROUTES, debug=True)
